#!/bin/bash

CPU_USAGE=$[ 100-$(vmstat 1 2|tail -1|awk '{print $15}') ]"%"
LANG=$( xset -q|grep LED| awk '{ if (substr ($10,5,1) == 1) print "RU"; else print "EN"; }' )
DATE_TIME=$( date +"%F %R" )
BATTERY=$( upower -i $(upower -e | grep 'BAT') | grep -E "percentage" | awk '{ print $2 }' )
BATTERY_SHOW=b:$BATTERY

# if $BATTERY is empty, i.e. it is not laptop
if [ -z "$BATTERY" ]
then
    # Show the sound muted notification
    BATTERY_SHOW=""
fi

xsetroot  -rv -name "$BATTERY_SHOW  c:$CPU_USAGE  $LANG  $DATE_TIME"
